#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=5005;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=(x<<1)+(x<<3)+ch-48,ch=getchar();}
	return x*f;
}
int n;
int u[N],v[N],w[N],tot,cnt;

signed main(){
	freopen("road.in","r",stdin);
	freopen("road.out","w",stdout);
	n=read();
	int sub=n,k=0;
	while(!(sub&1)) sub/=2,k++;
	if(n<=40){
		printf("2 %lld\n",n+1);
		for(int i=0;i<=n;i++)
			printf("1 114 %lld\n",i);
	}
	else if(sub==1){
		++tot,u[tot]=1,v[tot]=114,w[tot]=n;
		for(int i=0;i<k;i++){
			int U=1+i,V=2+i;
			if(V==k+1) V=114;
			++tot,u[tot]=U,v[tot]=V,w[tot]=0;
			++tot,u[tot]=U,v[tot]=V,w[tot]=(1ll<<i);
		}
		printf("18 %lld\n",tot);
		for(int i=1;i<=tot;i++)
			printf("%lld %lld %lld\n",u[i],v[i],w[i]);
	}
	else{
		k=log2(n);
		for(int i=0;i<k;i++){
			int U=1+i,V=2+i;
			if(V==k+1) V=114;
			++tot,u[tot]=U,v[tot]=V,w[tot]=0;
			++tot,u[tot]=U,v[tot]=V,w[tot]=(1ll<<i);		
		}
		cnt=k+1;
		int l=(1ll<<k),r=n+1;
		for(int i=15;~i;i--){
			if(l+(1ll<<i)<=r){
				++tot,u[tot]=i+1,v[tot]=114,w[tot]=l;
				l+=(1ll<<i);
			}			
		}
		printf("18 %lld\n",tot);
		for(int i=1;i<=tot;i++)
			printf("%lld %lld %lld\n",u[i],v[i],w[i]);
	}
	return 0;
}

